fix: include version in bundled and server package.json files#361
Open
shivammittal274 wants to merge 1 commit intomainfrom
Open
fix: include version in bundled and server package.json files#361shivammittal274 wants to merge 1 commit intomainfrom
shivammittal274 wants to merge 1 commit intomainfrom
Conversation
…artup @mariozechner/pi-coding-agent reads package.json at module load time (config.js:139) via getPackageDir(), which walks up from __dirname looking for package.json. In production, the bundled index.js runs from a directory with no package.json, causing a fatal ENOENT that crashes the server. Write a package.json (with type and version) into the bundle output directory so it ships alongside the production bundle. Also add version to the dist/server/package.json for compiled binary deployments. Slack thread: https://felafax.slack.com/archives/C0AF85H7PK8/p1772028629327479 https://claude.ai/code/session_01RjbFDanzVw73iiFAhh59Kp
Contributor
|
Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement. To sign the CLA, please add a comment to this PR with the following text: You only need to sign once. After signing, this check will pass automatically. Troubleshooting
|
Contributor
Greptile SummaryThis PR fixes an ENOENT crash on startup by ensuring the
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[main] --> B[getServerVersion]
B --> C[build config with version]
C --> D[build]
D --> E["write dist/server/package.json\n{ type: 'module', version }"]
D --> F[bundleWithPlugins envVars, version]
F --> G["Bun.build() → dist/server/bundle/"]
G --> H["write dist/server/bundle/package.json\n{ type: 'module', version }"]
H --> I[compileTarget from bundle]
I --> J["rmSync bundle dir"]
E --> K["dist/server/package.json persists\nnext to compiled binary"]
Last reviewed commit: 1e3e270 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This change ensures that the
versionfield is included in thepackage.jsonfiles generated during the build process, making version information available at runtime for modules that need it.Key Changes
versionfield to thepackage.jsonwritten into the bundle directory inbundleWithPlugins(). This is required by@mariozechner/pi-coding-agentwhich readspackage.jsonat module load time viagetPackageDir()to extract version and config information.package.jsonwritten todist/server/package.jsonto also include theversionfield for consistency.Implementation Details
package.jsonfiles now include{ type: 'module', version }instead of just{ type: 'module' }bundleWithPlugins()documenting why the version is needed for the pi-coding-agent dependencyhttps://claude.ai/code/session_01RjbFDanzVw73iiFAhh59Kp